package com.aliyun.oss;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;

public class AliOSSUtils {

    private AliOSSProperties properties;
    public AliOSSProperties getProperties() {
        return properties;
    }

    public void setProperties(AliOSSProperties properties) {
        this.properties = properties;
    }

    public String upload(MultipartFile file) throws IOException {
        String endpoint = properties.getEndpoint();
        String accessKeyId = properties.getAccessKeyId();
        String accessKeySecret = properties.getAccessKeySecret();
        String bucketName = properties.getBucketName();

        InputStream inputStream = file.getInputStream();

        String originalFilename = file.getOriginalFilename();
//        UUID.randomUUID().toString() + originalFilename.substring(originalFilename.lastIndexOf())
        return "";
    }
}
